//Copyright 2007 Iain Bapty
//
//This file is part of the ITunes Tag Manager.
//
//ITunes Tag Manager is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//ITunes Tag Manager is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with ITunes Tag Manager.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Text;
using iTunesLib;

namespace ITunesManager
{
    class Manager
    {
        private iTunesApp app;

        public Manager() 
        { 
            app = new iTunesAppClass(); 
        }

        public void Play()
        {
            app.Play();
        }

        public void Pause()
        {
            app.Pause();
        }

        public List<IITTrack> GetArtists_Capitalised()
        {
            List<IITTrack> matchedtracks = new List<IITTrack>();
            IITTrackCollection tracks = app.LibraryPlaylist.Tracks;

            for (int i = 0; i < tracks.Count; i++)
            {
                IITTrack track = tracks[i + 1];

                bool AllCaps = true;
                if (track.Artist != null && track.Artist.Length > 0)
                {
                    foreach (char artistChar in track.Artist)
                    {
                        if (Char.IsLower(artistChar) && !Char.IsWhiteSpace(artistChar) && !Char.IsSymbol(artistChar))
                        {
                            AllCaps = false;
                            break;
                        }
                    }

                    if (AllCaps)
                    {
                        matchedtracks.Add(track);
                    }
                }
            }

            return matchedtracks;
        }
    }
}
